dictory1 = {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'}
dictory2 = {10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen',
            17: 'seventeen', 18: 'eighteen', 19: 'nineteen'}
dictory3 = {20: 'twenty', 30: 'thirty', 40: 'forty', 50: 'fifty', 60: 'sixty', 70: 'seventy', 80: 'eighty',
            90: 'ninety'}

if __name__ == '__main__':
    length10 = 0
    length_total = 0
    for i in dictory1.values():
        length10 += len(i)
    for i in dictory2.values():
        length_total += len(i)
    for i in range(20, 100, 10):
        ten_dim = dictory3[i - (i % 10)]
        length_total += (len(ten_dim) * 10 + length10)
    length_total += length10
    length100 = length_total  # one - ninety-nine
    for i in range(100, 1000, 100):
        hundred_dim = dictory1[i // 100]
        length_total += (len(hundred_dim) + len('hundred')) * 100 + len('and') * 99 + length100
    length_total += len('onethousand')
    print(length_total)
